﻿using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Hosting;
using Microsoft.Extensions.Logging;

using System;
using System.Text.Json;
using System.Threading.Tasks;

using zijian666.DI;

namespace demo;

class Program
{
    static void Main(string[] args)
    {
        var services = new ServiceCollection()
            .AddTransient<MyClass2>();
        services.Add(new ServiceDescriptor(typeof(MyClass<>), typeof(MyClass<>), ServiceLifetime.Singleton));
        services.AddAutowired();
        var p = services.BuildServiceProvider();

        var my = p.GetRequiredService<MyClass<string>>();
    }

}


class MyClass<T>
{
    public MyClass()
    {
        
    }
    [Autowired]
    public MyClass2 MyClass2 { get; set; }
}

class MyClass2
{

}